<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="core.*,util.*" %>
<%@ page import="java.util.*,java.net.URLEncoder" %>
<%@ include file="/WEB-INF/include/checkAdmin.jsp" %>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/include/header.jsp" %>
<style>
    div.header span { display: inline-block; }
    div.header span:nth-child(odd)  { color: #aaa; }
    div.header span:nth-child(even) { margin-right: 50px; }
    pre { min-height: 400px; white-space: pre-line; }
</style>
</head>
<%
    RequestParameter param = new RequestParameter(request);
    int id = param.getInt("id", 0);
    Log log = LogDAO.selectById(id);

    String queryString = request.getQueryString().replaceAll("id=[0-9]+&?","");
    String url1 = "logList.jsp?" + queryString;
    String url2 = url1 + "&cmd=delete" + "&did=" + id;
%>
<body>
<%@ include file="/WEB-INF/include/menu.jsp" %>

<div class="container main">

    <h1>로그기록</h1>
    <hr />

    <h2><%= log.getCategory() %></h2>
    <hr />

    <div class="header">
        <span>사용자:</span>
        <span><%= log.getName() %></span>

        <span>IP:</span>
        <span><%= log.getIP() %></span>

        <span>일시:</span>
        <span><%= DateUtil.toYMDHMS(log.getWriteTime()) %></span>
    </div>

    <hr />

    <pre>
        <%= log.getURL() %>

        <%= log.getBody() %>
    </pre>

    <a href="<%= url1 %>" class="btn"><i class="icon-list"></i> 목록으로</a>
    <a href="<%= url2 %>" class="btn"><i class="icon-trash"></i> 삭제
    </a>

</div>

<%@ include file="/WEB-INF/include/footer.jsp" %>
</body>
</html>
